/*
 * AncherElement.cpp
 *
 *  Created on: 2010-6-6
 *      Author: guobc
 */

#include "AncherElement.h"
#include "Tools.h"
using namespace HA;

string AncherElement::mIds[] = { "A", "" };
string AncherElement::mEnds[] = { "A", "P", "DIV", "TD", "TR", "FORM", "LI",
		"BODY", "HTML", "" };

AncherElement::AncherElement() :
	HA::CommonElement() {

}

bool AncherElement::isMailLink() {
	string link = getLink();
	Tools::toLowerCase(link);
	return link.find_first_of("mailto:") != string::npos;
}

bool AncherElement::isJavascriptLink() {
	string link = getLink();
	Tools::toLowerCase(link);
	return link.find_first_of("javascript:") != string::npos;
}

bool AncherElement::isFTPLink() {
	string link = getLink();
	Tools::toLowerCase(link);
	return link.find_first_of("ftp://") != string::npos;
}

bool AncherElement::isIRCLink() {
	string link = getLink();
	Tools::toLowerCase(link);
	return link.find_first_of("irc://") != string::npos;
}

bool AncherElement::isHTTPLink() {
	string link = getLink();
	Tools::toLowerCase(link);
	return link.find_first_of("http://") != string::npos;
}

bool AncherElement::isHTTPSLink() {
	string link = getLink();
	Tools::toLowerCase(link);
	return link.find_first_of("https://") != string::npos;
}
